<template>
		<!-- 封装跳转详情页面的ui结构，样式，data数据 -->
	<view class="detail-item">
		<!-- 左侧图片展示 -->
		<view class="detail-left">
			<image :src="item.goods_small_logo || defaultImg" class="detail-img"></image>
		</view>
		<!-- 右侧图片展示 -->
		<view class="detail-right">
			<view class="detail-text">{{ item.goods_name }}</view>
			<view class="detail-box">
				<view class="detail-price">￥{{ item.goods_price | tofixed}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			item:{
				tyepe:Object,
				default:{}
			}
		},
		data() {
			return {
				// 当图片未显示时，提供默认图片
				 defaultImg:'../../static/homeselect.png'
			};
		},
		filters:{
			//价格统一两位小数点
			tofixed(num){
				return Number(num).toFixed(2)
			}
		}
	}
</script>

<style lang="scss">
.detail-item{
	display: flex;
	padding: 10px 5px;
	border-bottom:1px solid #f0f0f0 ;
		.detail-left{
			margin-right: 5px;
			
			.detail-img{
				width: 100px;
				height: 100px;
				display: block;
			}
		}
		.detail-right{
			margin-left: 10px;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			
			.detail-text{
				font-size: 13px;
			}
			.detail-box{
				.detail-price{
					color: #c00000;
					font-size: 16px;
				}
			}
		}
	
}
</style>